<?php
require_once('blockmodel.php');

/**
 * Bdat Site development
 * @author Will Skates
 */

/*----------------------------------------------------------------------------------------------------*/

/**
 * Outline of properties and functionality required to make and use content in the system which is used 
 * to populate masonry blocks. In this case event information blocks.
 * @author Will Skates
 *
 */
class Event extends BlockModel {
	
	//Define where we can find event data in the database.
	public $ctable = 'events';
	
	/**
	 * Construct an sql query to get the data for events from the database. (This version of the function includes date and time).
	 * @see BlockModel::getQuery()
	 */
	public function getQuery(  )
	{
		return 'SELECT ' . $this->ctable . '.uid,
						title,
						content,
						timestamp,
						endTimeStamp,
						location,
						user_profiles.name,
						user_profiles.link,
						gradyears.date AS gradyear,
						sticky FROM ' . $this->ctable . ' 
				LEFT JOIN user_profiles ON user_profiles.userid = ' . $this->ctable . '.author
				LEFT JOIN gradyears ON gradyears.uid = user_profiles.gradyear
				WHERE published = 1';
	}
	
	
}